1. Field of the Invention
The present invention relates to an apparatus and method for counting the number of objects in an image.
2. Description of the Related Art
There is a technique for taking a picture of people passing through an entrance of a store or a passage using a camera, detecting a person from the obtained image, and measuring the number of persons who passed. With this technique, it is known that correctly measuring the number of persons is difficult when the entrance or passage is crowded.
For example, the technique described in Japanese Patent Laid-Open No. 2005-92513 emits slit light from above a passage onto a line in the width direction of the passage, periodically obtains an image above the line, and detects moving objects (persons) from the obtained image. Then, it is determined whether the moving objects are the same person or not using a threshold for the distance between the moving objects, and the number of persons that passed is counted from the determination. At this time, if the level of congestion is low, the directions of the moving objects are not uniform, so some of the moving objects may obliquely pass with respect to the slit light. To address this, a unit configured to determine the level of congestion is provided, and the threshold is changed according to the level of congestion.
Another technique described in Japanese Patent Laid-Open No. 11-282999 periodically obtains an image above the line in the width direction of the passage, detects moving objects from the obtained image, and counts the number of objects, similar to the previously described technique, although not using slit light. At this time, if the level of congestion is high, the moving speed is low, thus resulting in difficulty in the counting. To address this, a unit configured to determine the level of congestion is provided, and a counting process is changed according to the level of congestion. More specifically, for a high level of congestion, because strict counting is difficult, the number of moving objects is counted by division of the total area of all the moving objects by the area of a predetermined standard moving object.
However, if the level of congestion becomes high, in addition to changes in the moving direction and the moving speed, an overlap between moving objects (persons) tends to be large. For example, if people brush shoulders while moving, the two persons are detected as a single moving object (person) with a known technique even when an image is obtained from directly thereabove. If an image is obtained from obliquely thereabove, it is advantageous in that a property, such as the face of a person, can be identified. In this case, however, people tend to overlap one another when the level of congestion is high, so a plurality of persons is still detected as a single object with a known technique. When trying to detect the upper body of a person, as in the upper-body detection described below, for example, if an overlap of people is large, the edges, which feature the upper body, are also hidden, and the upper body may be undetected. Accordingly, even if a threshold or counting process is changed, as in a known technique, when a person in itself is not correctly detected, the counting is not correct.